package cn.ibizlab.util.adapter.security;

import net.ibizsys.central.security.UserContextRuntime;

import java.util.HashMap;
import java.util.Map;

public class DefaultUserContextRuntime extends UserContextRuntime {
    Map<String, Object> sessionParams = new HashMap<>();
    @Override
    public Map<String, Object> getSessionParams() {
        if(this.sessionParams.isEmpty()) {
            this.sessionParams.put("srforgid", this.getOrgid());
            this.sessionParams.put("srforgcode", this.getOrgcode());
            this.sessionParams.put("srforgname", this.getOrgname());
            this.sessionParams.put("srforgsectorid", this.getDeptid());
            this.sessionParams.put("srforgsectorcode", this.getDeptcode());
            this.sessionParams.put("srforgsectorname", this.getDeptname());
            this.sessionParams.put("srfuserid", this.getUserid());
            this.sessionParams.put("srfusername", this.getUsername());

            this.sessionParams.put("srfpersonid", this.getUserid());
            this.sessionParams.put("srfpersonname", this.getUsername());
            this.sessionParams.put("srfdcid", this.getTenant());
            this.sessionParams.put("srfporg", this.getPorg());
            this.sessionParams.put("srfsorg", this.getSorg());
            this.sessionParams.put("srfpdept", this.getPdept());
            this.sessionParams.put("srfsdept", this.getSdept());
            this.sessionParams.put("srfusercode", this.getUsercode());
        }
        return sessionParams;
    }
}
